package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.LoginUser;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Json作为请求参数
 */
@RestController
@RequestMapping("json")
public class JsonController {

    //如果是json请求，可以再这里直接写PostMapping
    @PostMapping("login")
    public BaseRespVo login(@RequestBody Map map) {
        String username = (String) map.get("username");
        String password = (String) map.get("password");
        return BaseRespVo.ok();
    }
    @PostMapping("login2")
    public BaseRespVo login2(@RequestBody LoginUser user) {
        String username = user.getUsername();
        String password = user.getPassword();
        return BaseRespVo.ok();
    }
}
